<?php
@session_start();
$PurviewLevel=2;
$CheckChannelID=0;  
$PurviewLevel_Others="yingxiao_comment";

require("../../inc/common.inc.php");
require_once("../Admin_ChkPurview.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<TITLE>铭讯EOS网站后台管理</TITLE>
<Meta name="Keywords" Content="济南网站建设 济南网站制作 山东网站建设 济南铭讯软件有限公司">
<Meta name="Description" Content="济南网站制作：铭讯软件专业服务优秀企业，致力于网站建、设网站推广、网络营销一体的全访位网络服务商">
<link rel="stylesheet" href="../images/style.css" type="text/css">
</head>
<body> 
<?php
if($actions=="isok")
{
	if(!$iddb&&!$id){
		$fun->popmassage("请选择要操作的信息","","popback");
		exit();
	}
	elseif(is_array($iddb))
	{
		foreach($iddb AS $key=>$value){
			$db->excu("UPDATE mx_app_comment SET isok='1' WHERE id='$key'");
		}
	}elseif($id){
		$db->excu("UPDATE mx_app_comment SET isok='1' WHERE id='$id'");
	}
	$url=$fromurl?$fromurl:$FROMURL;
	jump2("修改成功","$FROMURL",0);
	exit();
}
elseif($actions=="unisok")
{
	if(!$iddb&&!$id){
		$fun->popmassage("请选择要操作的信息","","popback");
		exit();
	}
	elseif(is_array($iddb))
	{
		foreach($iddb AS $key=>$value){
			$db->excu("UPDATE mx_app_comment SET isok='0' WHERE id='$key'");
		}
	}elseif($id){
		$db->excu("UPDATE mx_app_comment SET isok='0' WHERE id='$id'");
	}
	$url=$fromurl?$fromurl:$FROMURL;
	jump2("修改成功","$FROMURL",0);
	exit();
}
elseif($actions=="del"){
	if(!$iddb&&!$id){
		$fun->popmassage("请选择要操作的信息","","popback");
		exit();
	}
	elseif(is_array($iddb))
	{
		foreach($iddb AS $key=>$value){
			$db->excu("DELETE FROM mx_app_comment WHERE id='$key' ");
		}
	}elseif($id){
		$db->excu("DELETE FROM mx_app_comment WHERE id='$id' ");
	}
	$url=$fromurl?$fromurl:$FROMURL;
	jump2("操作成功",$url,1);
	exit();
}
elseif ($actions=="savemodi"){
    $id=intval($id);
	if($id==0){
		$fun->popmassage("请选择要修改的信息","","popback");
		exit();
	}
	$content=dvhtmlencode(stripslashes($content));
	$recontent=dvhtmlencode(stripslashes($recontent));
	$isok=intval($isok);
	
    $files="";
    $files["content"]=$content;
    $files["isok"]=$isok;
	if (trim($recontent)!=""){
		$files["recontent"]=$recoontent;
		$files["redate"]=date("Y-m-d H:i:s");
		$files["reuserid"]=$_SESSION['mxadmin']['userid'];
	}
    $db->exe_update("mx_app_comment",$files,"id='$id'");

	if (trim($gotourl)==""){
	$gotourl=$FROMURL;
	}else{$gotourl=url_code($gotourl);}
	jump2("修改成功","$gotourl",1);
	exit();
}

require("../mx_head.php");?>
<div class="right">
<div class="gk">
			<div class="ti2 fl">服务评价管理</div>
			<ul class="fr">
				<li><span class="c1"><?php $znum=$db->listcount("mx_app_comment","");echo $znum;?></span><span>总条数</span></li>
				<li class="line"></li>
				<li><span class="c2"><?php $znum=$db->listcount("mx_app_comment"," and isok='1'");echo $znum;?></span><span>已审核</span></li>
				<li class="line"></li>
				<li><span class="c3"><?php $znum=$db->listcount("mx_app_comment"," and isok='0'");echo $znum;?></span><span>未审核</span></li>
			</ul>
			<div class="clear"></div>
</div>
<div class="height15"></div>

<?php
if ($actions=="modi"){
	$id=intval($id);
	$query="SELECT * FROM mx_app_comment where id='$id' limit 1";
	$result=$db->excu($query);
	if ($db->num_rows($result)<=0){
		$fun->popmassage("请选择要修改的信息","","popback");
		exit();
	}

	$rsdb=$db->fetch_array($result);
	$rsdb[isok]=intval($rsdb[isok]);
	$isok[$rsdb[isok]]=" checked ";
	if ($gotourl==""){$gotourl=url_encode($_SERVER['HTTP_REFERER']);}
?>
<script language="javascript">
setFormName("form1");

function check_form1(){
  if (!CheckLength("yname","姓名")){
	return false;
  }
  if (!CheckLength("bumen","部门")){
	return false;
  }
  if (!CheckLength("mobile","手机")){
	return false;
  }
  if(!CheckMobile("mobile")){
  	return false;
  }
  if (!CheckLength("jieshao","业务介绍")){
	return false;
  }
  return true;
}
</script>
<div class="xm2">
<h1 class="fl">回复服务评价</h1>
</div>
<div class="xm2_b">
<div class="height10"></div>
<table width='100%' cellspacing='1' cellpadding='8' class="table_southidc">
  <form name="form1"  id="form1" method="post" action="yx_comment.php" onSubmit="return check_form1();" enctype="multipart/form-data">
    <tr class="list"> 
      <td width='20%' align="center">姓&nbsp;&nbsp;名：</td>
      <td colspan="2"><?php echo $rsdb["yname"]?></td>
    </tr>
    <tr class="list"> 
      <td align="center">电&nbsp;&nbsp;话：</td>
      <td colspan="2"><?php echo $rsdb[tel]?></td>
    </tr>
    <tr class="list"> 
      <td align="center">邮&nbsp;&nbsp;箱：</td>
      <td colspan="2"><?php echo $rsdb[email]?></td>
    </tr>
    <tr class="list"> 
      <td align="center">QQ&nbsp;号：</td>
      <td colspan="2"><?php echo $rsdb[qq]?></td>
    </tr>
    <tr class="list"> 
      <td align="center">内&nbsp;&nbsp;容：</td>
      <td colspan="2"><textarea name="content" id="content" cols="70" rows="5"><?php echo dvhtmlcode($rsdb[content]) ?></textarea></td>
    </tr>
    <tr class="list"> 
      <td align="center">回&nbsp;&nbsp;复：</td>
      <td colspan="2"><textarea name="recontent" id="recontent" cols="70" rows="5"><?php echo dvhtmlcode($rsdb[recontent]) ?></textarea></td>
    </tr>
    <tr class="list"> 
      <td align="center" height="30">状&nbsp;&nbsp;态：</td>
      <td colspan="2"> 
        <input type="radio" name="isok" value="1" class="input_check" <?php echo $isok[1]?>>
        已验证 
        <input type="radio" name="isok" value="0" class="input_check" <?php echo $isok[0]?>>
        未验证</td>
    </tr>
    <tr class="list"> 
      <td></td>
      <td colspan="2"> 
        <input class="button" type='submit' name='Submit' value='提交回复'>
		<input class="button1" type="button" name="back" value="返回" onclick="history.back();" />
		<input type="hidden" name="id" value="<?php echo $rsdb[id] ?>">
		<input type="hidden" name="gotourl" value="<?php echo $gotourl?>">
		<input type="hidden" name="actions" value="savemodi"></td>
    </tr>
  </form>
</table>
<div class="height10"></div>
</div>
<?php 
}
else{  
  $str="";
  $s="";
  if(empty($pageindex)){
      $pageindex=1;
  }
  $pagesize=15;
  if ($isok!=""){
  	$isok=intval($isok);
	$str.=" and isok='$isok' ";
	$s.="isok=$isok&";
  }
  
  if ($keyword!=""){
	$str.=" and (yname like '%$keyword%' or content like '%$keyword%') ";
	$s.="keyword=$keyword&";
  }
  
  if ($inputdate!=""){
	$str.=" and adddate >='$inputdate 00:00:00'  and adddate<='$inputdate 23:59:59'  ";
	$s.="inputdate=$inputdate&";
  }
  
  $table=" mx_app_comment ";
  $order=" order by adddate desc, id desc";
  $column=" * ";
  $biaoid="id";
  $c=$db->listcount($table,$str);
  
  $list=$db->list1($pageindex,$pagesize,$table,$column,$str,$order,$biaoid);
?>
<div class="xm2">
<h1 class="fl">服务评价管理</h1>
</div>
<div class="xm2_b" style="border-bottom:0px;">
<div class="t">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td>
	<div class="an1"><a href="yx_comment.php">所有信息</a></div>
	<div class="an2"><a href="yx_comment.php?isok=1">已审核</a></div>
	<div class="an2"><a href="yx_comment.php?isok=0">未审核</a></div>
	</td>
	</tr>
	</table>
</div>
<div class="t">
<table border="0" cellpadding="0" cellspacing="1" class="search_from">
<form name="form2" action="yx_comment.php" method="post">
 <tr>
   <td>&nbsp;关键字：</td><td><input name="keyword" type="text" id="keyword" value="" size="10" class="search_input"/></td>
  <td>&nbsp;提交日期：</td>
  <td><input name="inputdate" type="text" id="inputdate" value="" size="10" class="search_input">
	  <script language="javascript" type="text/javascript">
	  Calendar.setup({
	  	  inputField     :    "inputdate",
	  	  ifFormat       :    "%Y-%m-%d",
	  	  showsTime      :    false,
	  	  timeFormat     :    "24"
	  });
	  </script>
  </td>
  <td><select name="isok"><option value="">状态</option><option value="1">已审核</option><option value="0">未审核</option></select></td>
  <td><input type="submit" name="Submit3" value="搜索" class="button2" /></td>
  </tr>
</form>
</table>
</div>
</div>
<div class="xm2_b">
<div class="height10"></div>
  <form name="form1" method="post" action="yx_comment.php">
<?php
  if (!is_array($list) or $c==0){
  echo "<tr class=\"list1\" height=30 onMouseOver=\"this.className='list2'\" onmouseout=\"this.className='list1'\"><td colspan=8><center>暂无信息</center></td></tr>";
  }
  else{
  for($i=0;$i<count($list);$i++){
		$list[$i][isok]=$list[$i][isok]?"<A HREF='?actions=unisok&id=".$list[$i][id]."' style='color:red;' title='取消审核'>已审核</A>":"<A HREF='?actions=isok&id=".$list[$i][id]."' style='color:blue;' title='审核通过'>未审核</A>";
?>
 <table width='100%' cellspacing='1' cellpadding='3' class="table_southidc" style="width:95%; margin-bottom:10px;">
    <tr style="color:#333;" bgcolor="#ededed">
      <td width="70%" height="25" colspan="3" align="left"><input type="checkbox" name="iddb[<?php echo $list[$i][id]?>]" value="<?php echo $list[$i][id]?>" class="input_check">&nbsp;&nbsp;<b>姓名：</b><b><?php echo $list[$i][yname]?></b>&nbsp;&nbsp;&nbsp;&nbsp;<b>评价：</b><b><?php echo $list[$i][clerkname]?></b></td>
      <td width="30%" align="right"><?php echo $list[$i][isok]?>&nbsp;&nbsp;<a href="yx_comment.php?actions=modi&id=<?php echo $list[$i]["id"] ?>">回复</a>&nbsp;&nbsp;<a href="yx_comment.php?actions=del&id=<?php echo $list[$i]["id"] ?>">删除</a>&nbsp;&nbsp;</td>
    </tr>
  <tr class="list">
    <td height="25" colspan="4" align="left" bgcolor="FAFAFA">&nbsp;&nbsp;&nbsp;提交时间：&nbsp;<?php echo $list[$i]["adddate"];?>&nbsp;&nbsp;&nbsp;&nbsp;电话：<?php echo $list[$i]["tel"]?>&nbsp;&nbsp;&nbsp;&nbsp;邮件：<?php echo $list[$i]["email"];?>&nbsp;&nbsp;&nbsp;&nbsp;QQ：<?php echo $list[$i]["qq"];?></td>
  </tr>
  <tr class="list">
    <td colspan="4" valign="top">
	  <table width="100%" border="0" cellspacing="10" cellpadding="0" style="font-size: 12px;color: #333333;">
        <tr>
          <td valign="top" align="left" style="line-height:25px;">
		  <?php echo $list[$i]["content"];?>
            <br>
			<TABLE style="BORDER-RIGHT: #48818A 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #48818A 1px dotted; BORDER-LEFT: #48818A 1px dotted; BORDER-BOTTOM: #48818A 1px dotted" cellSpacing=0 cellPadding=6 width="100%" align=center border=0>
<TBODY>
<TR>
<TD  bgColor="#FFFFFF"><span style="font-size: 12px;color: #CC6600;"><?php
echo trim($list[$i]["recontent"])!=""?$list[$i]["recontent"]:"未回复"; 
if ($list[$i]["reuserid"]!=0){
	$userinfo=$db->getmembername($list[$i]["reuserid"]);
	echo "<br/>".$userinfo["realname"]."&nbsp;：&nbsp;&nbsp;&nbsp;".$list[$i]["redate"];
}
?></span><BR/></TD></TR></TBODY></TABLE>					  </td>
        </tr>
      </table>      	</td>
  </tr>
</table>
<?php
}
?>
<?php }?>
  <input type="hidden" name="actions" id="actions" value="" />
  </form>
<?php if ($c>0){?>
			<div class="height10"></div>
			<div class="do_div">
				<div class="l"><a href="javascript:CheckAll(document.form1,'all')">全选</a>&nbsp;<a href="javascript:CheckAll(document.form1,'')">反选</a><input type="hidden" name="jobs" value="0"></div>
				<div class="l2">
				选择操作：
				<a href="javascript:document.form1.actions.value='isok';document.form1.submit();">审核</a>
				<a href="javascript:document.form1.actions.value='unisok';document.form1.submit();">取消审核</a>
				<a href="javascript:if (confirm('确定要删除选中的信息吗?')){ document.form1.actions.value='del';document.form1.submit();}">删除选中信息</a>
				</div>
			</div>
<?php }?>
<?php
  if ($c>$pagesize){
?>
			<div class="clear"></div>
			<div class="pagination">
			<?PHP
			echo $db->ThePage_mxsoft($s,$pageindex,$c,$pagesize)
			?>
			</div>
			<div class="clear"></div>
			<div class="height10"></div>
<?php
	}
?>

<div class="height10"></div>
</div>
<?php
}
?>
<div class="clear"></div>
<div class="height10"></div>
</div>
<?php require("../mx_foot.php");?>
<div class="clear"></div>
<div class="height10"></div>
</body>
</html>
